package com.jeesite.modules.utils;


import com.icecold.utils.StringUtils;

public class Common {

    /**
     * 头像的判断
     */
    public static String avatarUrlSet(String avatarUrl,String baseUrl){
        if(avatarUrl!=null){
            if(avatarUrl.indexOf("http://testbbjz.zzlmvip.com:8880")!=-1){
                avatarUrl = avatarUrl.replace("http://testbbjz.zzlmvip.com:8880",baseUrl);
                return avatarUrl;
            }
            if(avatarUrl.indexOf("http://testbbjz.zzlmvip.com:8005")!=-1){
                avatarUrl = avatarUrl.replace("http://testbbjz.zzlmvip.com:8005",baseUrl);
                return avatarUrl;
            }
            if(avatarUrl.indexOf("http://produce.zzlmvip.com:8880")!=-1){
                avatarUrl = avatarUrl.replace("http://produce.zzlmvip.com:8880",baseUrl);
                return avatarUrl;
            }

            if(avatarUrl.indexOf("http://produce.zzlmvip.com:8005")!=-1){
                avatarUrl = avatarUrl.replace("http://produce.zzlmvip.com:8005",baseUrl);
                return avatarUrl;
            }

            if(avatarUrl.indexOf("http://47.99.214.52:8005")!=-1){
                avatarUrl = avatarUrl.replace("http://47.99.214.52:8005",baseUrl);
                return avatarUrl;
            }

            if(avatarUrl.indexOf("http://47.99.214.52:8880")!=-1){
                avatarUrl = avatarUrl.replace("http://47.99.214.52:8880",baseUrl);
                return avatarUrl;
            }

        }

        if(StringUtils.isNotEmpty(avatarUrl) && !avatarUrl.startsWith("http")){
            avatarUrl = baseUrl+avatarUrl;
        }else{
            //默认头像
            if(StringUtils.isEmpty(avatarUrl)){
                avatarUrl = baseUrl+"/userfiles/default/touxiang.png";
            }
        }
        return avatarUrl;
    }



    /**
     * 昵称的判断
     */
    public static String nichengSet(String nicheng){
        if(StringUtils.isEmpty(nicheng)){
            return nicheng;
        }
        return nicheng;
    }
}
